using System;
using System.Configuration;
using System.Web;

namespace Logic.SocialNetworks
{
	public class FacebookConfig : IFacebookConfig
	{
		public string AppKey
		{
			get { return ConfigurationManager.AppSettings["facebook_appKey"]; }
		}

		public string SessionKey
		{
			get
			{
				var cookie = HttpContext.Current.Request.Cookies["FB_SessionKey"];
				return cookie == null ? string.Empty : cookie.Value;
			}
		}

		public string UserId
		{
			get
			{
				var cookie = HttpContext.Current.Request.Cookies["FB_Uid"];
				return cookie == null ? string.Empty : cookie.Value;
			}
		}

		public string UserSecret
		{
			get
			{
				var cookie = HttpContext.Current.Request.Cookies["FB_UserSecret"];
				return cookie == null ? string.Empty : cookie.Value;
			}
		}

		public string LoginSuccessUrl
		{
			get { return HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Authority + "/Auth.aspx?from=facebook"; }
		}

		public string LoginFailUrl
		{
			get { return HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Authority + "/Auth.aspx?from=facebook"; }
		}

		public bool OfflineAccess
		{
			get { return false; }
			set { throw new NotImplementedException(); }
		}

		public bool PublishStream
		{
			get { return true; }
			set { throw new NotImplementedException(); }
		}
	}
}